package com.pktechan.api.service.impl;

import com.pktechan.api.base.BaseMapper;
import com.pktechan.api.base.BaseServiceImpl;
import com.pktechan.api.dao.TradeOrderDetailMapper;
import com.pktechan.api.entity.TradeOrderDetail;
import com.pktechan.api.service.TradeOrderDetailService;
import com.pktechan.api.vo.TradeOrderDetailVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service("tradeOrderDetailService")
@Transactional
public class TradeOrderDetailServiceImpl extends BaseServiceImpl<TradeOrderDetail> implements TradeOrderDetailService {

    @Autowired
    private TradeOrderDetailMapper tradeOrderDetailMapper;

    /**
     * 由业务类实现
     *
     * @return
     */
    @Override
    public BaseMapper<TradeOrderDetail> getBaseMapper() {
        return tradeOrderDetailMapper;
    }

    /**
     * 根据订单ID获取订单详情集合
     *
     * @param tradeOrderId
     * @return
     */
    @Override
    public List<TradeOrderDetailVO> getTradeOrderDetailByOrderId(Integer tradeOrderId) {
        return tradeOrderDetailMapper.getTradeOrderDetailByOrderId(tradeOrderId);
    }

    /**
     * 20240604，该方法之后由 getOrderVipRank 取代
     * 根据订单ID查询 21-注册VIP 22-注册配送商类别的订单明细
     *
     * @param tradeOrderId
     * @return
     */
    @Override
    public TradeOrderDetail getRegisterOrderDetail(Integer tradeOrderId) {
        return tradeOrderDetailMapper.getRegisterOrderDetail(tradeOrderId);
    }

    @Override
    public Integer getOrderVipRank (Integer tradeOrderId){
        return tradeOrderDetailMapper.getOrderVipRank(tradeOrderId);

    }
    /**
     * 查询订单积分运费详情
     * @param tradeOrderId
     * @return
     */
    @Override
    public TradeOrderDetailVO getOrderDetailById(Integer tradeOrderId) {
        return tradeOrderDetailMapper.getOrderDetailById(tradeOrderId);
    }
}
